package com.enation.app.javashop.core.client.fallback.member;

import com.enation.app.javashop.core.client.feignimpl.member.MemberCollectionGoodsFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 会员商品收藏相关熔断fallback factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:25
 **/
@Component
public class MemberCollectionGoodsFallbackFactory extends BaseFallbackFactory<MemberCollectionGoodsFeignImpl> {
    @Override
    protected MemberCollectionGoodsFeignImpl fallback() {
        return new MemberCollectionGoodsFallback();
    }

    /**
     * 会员商品收藏相关熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 下午3:58
     * @since v7.0
     */
    @Component
    public static class MemberCollectionGoodsFallback implements MemberCollectionGoodsFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public Integer getGoodsCollectCount(Long goodsId) {
            logger.error("获取ID为" + goodsId + "的商品的收藏数量");
            return null;
        }

        @Override
        public void updateGoodsName(Long goodsId, String goodsName) {
            logger.error("更新收藏商品的商品名称出错，goodsid"+goodsId+",name"+goodsName);
        }


    }

}
